home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / djport / ezport.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-01-04  |  5.7 KB  |  196 lines

  1. VERSION 5.00
  2. Object = "*\A..\..\..\LIFESA~1\VBPROJ~1\EZPORT\ezport.vbp"
  3. Begin VB.Form EZPortFrm 
  4.    AutoRedraw      =   -1  'True
  5.    Caption         =   "EZPort sample:"
  6.    ClientHeight    =   2760
  7.    ClientLeft      =   60
  8.    ClientTop       =   345
  9.    ClientWidth     =   3405
  10.    BeginProperty Font 
  11.       Name            =   "Times New Roman"
  12.       Size            =   9.75
  13.       Charset         =   0
  14.       Weight          =   400
  15.       Underline       =   0   'False
  16.       Italic          =   0   'False
  17.       Strikethrough   =   0   'False
  18.    EndProperty
  19.    LinkTopic       =   "Form1"
  20.    ScaleHeight     =   2760
  21.    ScaleWidth      =   3405
  22.    StartUpPosition =   3  'Windows Default
  23.    Begin EZPortPrj.EZPort EZPort1 
  24.       Height          =   525
  25.       Index           =   1
  26.       Left            =   1890
  27.       TabIndex        =   5
  28.       Top             =   2025
  29.       Width           =   1260
  30.       _ExtentX        =   2223
  31.       _ExtentY        =   926
  32.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  33.          Name            =   "Times New Roman"
  34.          Size            =   9.75
  35.          Charset         =   0
  36.          Weight          =   400
  37.          Underline       =   0   'False
  38.          Italic          =   0   'False
  39.          Strikethrough   =   0   'False
  40.       EndProperty
  41.    End
  42.    Begin EZPortPrj.EZPort EZPort1 
  43.       Height          =   525
  44.       Index           =   0
  45.       Left            =   45
  46.       TabIndex        =   4
  47.       Top             =   525
  48.       Width           =   1260
  49.       _ExtentX        =   2223
  50.       _ExtentY        =   926
  51.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  52.          Name            =   "Times New Roman"
  53.          Size            =   9.75
  54.          Charset         =   0
  55.          Weight          =   400
  56.          Underline       =   0   'False
  57.          Italic          =   0   'False
  58.          Strikethrough   =   0   'False
  59.       EndProperty
  60.    End
  61.    Begin VB.CommandButton Command1 
  62.       Caption         =   "Get Color"
  63.       Height          =   495
  64.       Left            =   75
  65.       TabIndex        =   3
  66.       Top             =   1950
  67.       Width           =   1005
  68.    End
  69.    Begin VB.TextBox Text1 
  70.       Height          =   315
  71.       Left            =   690
  72.       TabIndex        =   2
  73.       Text            =   "1"
  74.       Top             =   1215
  75.       Width           =   270
  76.    End
  77.    Begin VB.ListBox List1 
  78.       Height          =   510
  79.       ItemData        =   "ezport.frx":0000
  80.       Left            =   2400
  81.       List            =   "ezport.frx":000A
  82.       TabIndex        =   0
  83.       Top             =   1215
  84.       Visible         =   0   'False
  85.       Width           =   1020
  86.    End
  87.    Begin VB.Label Label3 
  88.       AutoSize        =   -1  'True
  89.       Caption         =   "Click a port to connect:"
  90.       Height          =   225
  91.       Left            =   840
  92.       TabIndex        =   7
  93.       Top             =   60
  94.       Width           =   1845
  95.    End
  96.    Begin VB.Label Label2 
  97.       AutoSize        =   -1  'True
  98.       Caption         =   "Port:"
  99.       Height          =   225
  100.       Left            =   165
  101.       TabIndex        =   6
  102.       Top             =   1230
  103.       Width           =   375
  104.    End
  105.    Begin VB.Line Line1 
  106.       Visible         =   0   'False
  107.       X1              =   2295
  108.       X2              =   3180
  109.       Y1              =   1020
  110.       Y2              =   1050
  111.    End
  112.    Begin VB.Label Label1 
  113.       AutoSize        =   -1  'True
  114.       Caption         =   "Select target"
  115.       ForeColor       =   &H00FF0000&
  116.       Height          =   225
  117.       Left            =   1680
  118.       TabIndex        =   1
  119.       Top             =   375
  120.       Visible         =   0   'False
  121.       Width           =   990
  122.    End
  123. Attribute VB_Name = "EZPortFrm"
  124. Attribute VB_GlobalNameSpace = False
  125. Attribute VB_Creatable = False
  126. Attribute VB_PredeclaredId = True
  127. Attribute VB_Exposed = False
  128. Private Sub Command1_Click()
  129.   MsgBox EZPort1(0).GetPortColor(Text1)
  130. End Sub
  131. Private Sub EZPort1_Click(Index As Integer, Left As Long, top As Long, Port As Integer)
  132.   Dim lngL As Long
  133.   Dim lngT As Long
  134.   With EZPort1(Index)
  135.     lngL = .Left + Left
  136.     lngT = .top + top
  137.     Select Case .PortState(Port)
  138.       Case stActive
  139.         If Label1.Visible Then
  140.           With Line1
  141.             .X1 = List1.Left
  142.             .Y1 = List1.top
  143.             .X2 = lngL
  144.             .Y2 = lngT
  145.             .Visible = True
  146.             .ZOrder
  147.           End With
  148.           Label1.Visible = False
  149.         Else
  150.           With List1
  151.             .ZOrder
  152.             .Left = lngL
  153.             .top = lngT
  154.             .Visible = True
  155.           End With
  156.         End If
  157.       Case stInactive
  158.         .PortState(Port) = stOff
  159.       Case stOff
  160.         .PortState(Port) = stActive
  161.         List1.Visible = False
  162.     End Select
  163.   End With
  164. End Sub
  165. Private Sub Form_Load()
  166. '  EZPort(2).ZOrder 1
  167. End Sub
  168. Private Sub List1_Click()
  169.   With List1
  170.     Select Case .List(.ListIndex)
  171.       Case "Connect"
  172.         Label1.Visible = True
  173.       Case "Disconnect"
  174.         Call SetStatus(.Left, .top, stInactive)
  175.     End Select
  176.     .Visible = False
  177.   End With
  178. End Sub
  179. Private Sub SetStatus(Left As Long, top As Long, status As PortStates)
  180.   Dim intPort As Integer
  181.   Dim intEZ As Integer
  182.   Dim lngL As Long
  183.   Dim lngT As Long
  184.   Dim intX As Integer
  185.   For intEZ = 0 To EZPort1.Count - 1
  186.     With EZPort1(intEZ)
  187.       For intX = 1 To .Ports
  188.         Call .LocatePort(intX, lngL, lngT)
  189.         If (Left = lngL + .Left) And (top = lngT + .top) Then
  190.           .PortState(intX) = status
  191.         End If
  192.       Next
  193.     End With
  194.   Next
  195. End Sub
  196.